//专门用来写接口请求函数
import Ajax from '@/utils/request'
import mockAjax from '@/utils/mockRequest'
//请求获取三级分类的数据
export const reqCategoryList = () => {
    return Ajax({
        url: '/product/getBaseCategoryList',
        method: 'get'
    })
}


//首页轮播图banner
export const reqBannerList = () => {
    return mockAjax({
        url: '/banner',
        method: 'get'
    })
}

//楼层floor
export const reqFloorList = () => {
    return mockAjax({
        url: '/floor',
        method: 'get'
    })
}

//请求获取搜索页面数据
// /api/list  
// POST
// 参数例子
// {
//     "category3Id": "61",
//     "categoryName": "手机",
//     "keyword": "小米",
//     "order": "1:desc",
//     "pageNo": 1,
//     "pageSize": 10,
//     "props": ["1:1700-2799:价格", "2:6.65-6.74英寸:屏幕尺寸"],
//     "trademark": "4:小米"
//   }
// searchParams空对象 请求体参数
export const reqGoodsListInfo = (searchParams) => {
    return Ajax({
      url:'/list',
      method:'post',
      data:searchParams
    })
  }

// reqGoodsListInfo({})


// 获取验证码
// /api/user/passport/sendCode/{phone}
// get

export const reqGetCode = (phone)=>{
    return Ajax({
        url:`/user/passport/sendCode/${phone}`,
        method: 'get'
    })
}

//注册
// /api/user/passport/register
// post

export const reqUserRegister = (userInfo) => {
    return Ajax({
        url:'/user/passport/register',
        method: 'post',
        data:userInfo
    })
}

//登录
// /api/user/passport/login
// post
export const reqUserLogin = (userInfo)=>{
    return Ajax({
        url:'/user/passport/login',
        method: 'post',
        data:userInfo
    })
}

// token获取用户信息
// /api/user/passport/auth/getUserInfo
// get 

export const reqGetUserinfo = ()=>{
    return Ajax({
        url:'/user/passport/auth/getUserInfo',
        methods:'get',

    })
}